# _*_ coding:utf-8 _*_
# at:2024-07-24
# author:zizle

import json
with open('ume_ledger.json', 'r', encoding='utf8') as f:
    lines = f.readlines()

with open('ume_ledger_aliyun.json', 'a+', encoding='utf8') as f2:
    for ln in lines:
        d = json.loads(ln)
        if d['user_id'] and d['user_id'] != '61813eafed3a9600019c960e':
            print('continue')
            continue

        js = {
            '_id': {'$oid': d['_id']},
            'category_name': d['category_name'],
            'create_time': d['create_time'],
            'parent_id': {'$oid': d['parent_id']} if d['parent_id'] else '',
            'state': d['state'],
            'user_id': {'$oid': d['user_id']} if d['user_id'] else ''
        }
        f2.write(json.dumps(js, ensure_ascii=False) + '\n')
